package com.maiji.cloud.entities.login;

import java.util.Date;

import cn.hutool.core.util.NumberUtil;
import com.baomidou.mybatisplus.annotations.TableId;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.Table;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * Description:  用户基本信息表
 * @author zhanglr  
 * @date 2019年6月12日
 */

@NoArgsConstructor
@Data
@Accessors(chain=true)
@Table(name = "user_info")
public class UserInfo {

	@TableId
	@Column(name = "uu_id", type = MySqlTypeConstant.VARCHAR, length = 50, isKey = true)
    private String uuId; //主键
	
	@Column(name = "user_id", type = MySqlTypeConstant.VARCHAR, length = 50)
	private String userId; //用户id
	
	@Column(name = "nick_name", type = MySqlTypeConstant.VARCHAR, length = 50)
	private String nickName; //昵称 
	
	@Column(name = "head_url", type = MySqlTypeConstant.VARCHAR, length = 100)
	private String headUrl; //头像
	
	@Column(name = "main_page_url", type = MySqlTypeConstant.VARCHAR, length = 100)
	private String mainPageUrl; //个人主页背景图片
	
    @Column(name = "reg_date", type = MySqlTypeConstant.DATETIME)
    private Date regDate;  //注册日期

    @Column(name = "area_id", type = MySqlTypeConstant.VARCHAR, length = 50)
    private String areaId; // 注册地区

	@Column(name = "sex", type = MySqlTypeConstant.INT, length = 2)
	private Integer sex; // 0:女，1:男
	
	@Column(name = "birth", type = MySqlTypeConstant.DATE)
	private Date birth; //出生日期
	
	@Column(name = "height", type = MySqlTypeConstant.VARCHAR, length = 20)
	private String height; //身高

    @Column(name = "weight", type = MySqlTypeConstant.VARCHAR, length = 20)
	private String weight; //体重

    @Column(name = "body_fat_rate", type = MySqlTypeConstant.VARCHAR, length = 20)
	private String bodyFatRate; //体脂率
	
	@Column(name = "target_weight", type = MySqlTypeConstant.VARCHAR, length = 20)
	private String targetWeight; //目标体重

    @Column(name = "is_use", type = MySqlTypeConstant.INT, length = 20,defaultValue = "0")
	private Integer isUse; //是否用过麦吉减肥法
	
	@Column(name = "stage_start_time", type = MySqlTypeConstant.DATETIME)
	private Date stageStartTime; //麦吉阶段开启时间
	
	@Column(name = "stage", type = MySqlTypeConstant.INT, length = 20, defaultValue = "1")
	private Integer stage; //阶段..废弃字段
	
	@Column(name = "day", type = MySqlTypeConstant.INT, length = 20, defaultValue = "1" )
	private Integer day; //天数..废弃字段
	
	@Column(name = "id_card", type = MySqlTypeConstant.VARCHAR, length = 50)
	private String idCard; //身份证号
	
	@Column(name = "real_name", type = MySqlTypeConstant.VARCHAR, length = 20)
	private String realName; //真实姓名
	
	@Column(name = "pay_password", type = MySqlTypeConstant.VARCHAR, length = 50)
	private String payPassword;//支付密码

    public UserInfo setHeight(String height) {
        if (! NumberUtil.isNumber(height)) this.height = height;
        else this.height = NumberUtil.decimalFormat("00.0", Double.valueOf(height));
        return this;
    }

    public String getHeight() {
        if (! NumberUtil.isNumber(height)) return height;
        return NumberUtil.decimalFormat("00.0", Double.valueOf(height));
    }

    public UserInfo setTargetWeight(String targetWeight) {
        if (! NumberUtil.isNumber(targetWeight)) this.targetWeight = targetWeight;
        else this.targetWeight = NumberUtil.decimalFormat("00.0", Double.valueOf(targetWeight));
        return this;
    }

    public String getTargetWeight() {
        if (! NumberUtil.isNumber(targetWeight)) return targetWeight;
        return NumberUtil.decimalFormat("00.0", Double.valueOf(targetWeight));
    }

    public UserInfo setWeight(String weight) {
        if (! NumberUtil.isNumber(weight)) this.weight = weight;
        else this.weight = NumberUtil.decimalFormat("00.0", Double.valueOf(weight));
        return this;
    }

    public String getWeight() {
        if (! NumberUtil.isNumber(weight)) return weight;
        return NumberUtil.decimalFormat("00.0", Double.valueOf(weight));
    }
	
}
